package cn.hesion.designpattern.Factory.SingleFactory;

import cn.hesion.designpattern.Factory.ICource;
import cn.hesion.designpattern.Factory.JavaCources;
import cn.hesion.designpattern.Factory.PythonCources;

public class SingleCourceFactory {
    //工厂模式的创造模式
     public ICource create(String name){
         if("java".equals(name)){
             return  new JavaCources();
         }else if("python".equals(name)){
             return new PythonCources();
         }else {
             System.out.println("无该课程");
             return null;
         }
     }
}
